package br.com.gerenciamento.pg.framework.jpa.model;


public class EnumConvertableHelper {

	@SuppressWarnings("unchecked")
	public static <E> E getFromValue(Class<E> e, E[] values, Object value) {
		for (E enu : values) {
			if (((EnumConvertable<E, ?>) enu).convert().equals(value)) {
				return enu;
			}
		}
		throw new RuntimeException("EnumConstantNotPresentException: " + value);
	}
}
